<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>查询到的快递信息 -- 快递e栈服务平台</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
    <style type="text/css">
        body{
            margin: 0;
            padding: 0;
            background-color: #eeeeee;
            font-family: "楷体",serif;
        }
        .item{
            margin: 20px;
            margin-bottom: 50px;
        }
        .item_top{
            text-align: center;
        }
        .item_top>span{
            font-size:14px;
            display: inline-block;
            padding: 5px 12px;
            background-color: #ddd;
            color:#fff;
            border-radius: 5px;
        }
        .item_content{
            background-color: #fff;
            padding: 25px 15px;
            margin-top: 6px;
        }
        .item_content_top_1{
            font-size: 24px;
            font-weight: bold;
        }
        .item_content_top_2{
            color:#eee;
            font-size: 14px;
            margin: 5px 0px;
        }
        .item_content_top_3{
            margin: 10px 0px;
        }
        .item_content_top_4{
            margin: 10px 0px;
        }
        .item_content_bottom>a{
            text-decoration: none;
            color:#33e;
        }
    </style>
</head>
<body>
<div class="content" id="express"></div>
</body>
<script src="./js/jquery-2.1.4.min.js"></script>
<script src="./js/layer/layer.js"></script>
<script>
    $(function () {
        var windowID = layer.load(2);
        $.getJSON("/wechat/findExByExNum.do",null,function(values){
            layer.close(windowID);
            if (values.status===0){
                // values: {"id":177,"ex_num":"12312652","username":"小张","userphone":"13897845154","company":"安能快递","code":"998217","intime":"2021-03-10 09:03:19","outtime":"未出库","status":"待取件","staffphone":"16667778888"}
                let htmlContent = null;
                let ex = values.data;
                if (ex.outtime==="未出库"){
                    htmlContent = '<div class="item">' +
                        '<div class="item_top"><span>' + ex.intime + '</span></div>' +
                        '<div class="item_content">' +
                        '<div class="item_content_top">' +
                        '<div class="item_content_top_1">入库时间：' + ex.intime + '</div>' +
                        '<div class="item_content_top_2">出库时间：' + ex.outtime + '</div>' +
                        '<div class="item_content_top_3">状态：'+ ex.status +'</div>' +
                        '<div class="item_content_top_4">' +
                        '收件人:<span style="color:#0055aa">' + ex.username + '</span><br>' +
                        '收件人手机号:<span style="color:#0055aa">' + ex.userphone + '</span><br>' +
                        '取件码:<span style="color:#0055aa">' + ex.code + '</span><br>' +
                        '快递公司:' + ex.company + '<br>' +
                        '运单号码:' + ex.ex_num + '<br>' +
                        '站点电话:' + ex.staffphone + '<br>' +
                        '</div>' + '</div>' +
                        '<hr>' +
                        '<div class="item_content_bottom">' +
                        '<a href="/wechat/generateQRCodeContent.do?type=express&code=' + ex.code + '">取件二维码</a>' +
                        '</div>' + '</div>' + '</div>';
                } else {
                    htmlContent = '<div class="item">' +
                        '<div class="item_top"><span>' + ex.outtime + '</span></div>' +
                        '<div class="item_content">' +
                        '<div class="item_content_top">' +
                        '<div class="item_content_top_1">出库时间：' + ex.outtime + '</div>' +
                        '<div class="item_content_top_2">入库时间：' + ex.intime + '</div>' +
                        '<div class="item_content_top_3">状态：'+ ex.status +'</div>' +
                        '<div class="item_content_top_4">' +
                        '收件人:<span style="color:#0055aa">' + ex.username + '</span><br>' +
                        '收件人手机号:<span style="color:#0055aa">' + ex.userphone + '</span><br>' +
                        '快递公司:' + ex.company + '<br>' +
                        '运单号码:' + ex.ex_num + '<br>' +
                        '站点电话:' + ex.staffphone + '<br>' +
                        '</div>' + '</div>' +
                        '<hr>' +
                        '<div class="item_content_bottom">' +
                        '<a href="#">有疑问 ? 点了也没用</a>' +
                        '</div>' + '</div>' + '</div>';
                }
                $("#express").append(htmlContent);
            } else if (values.status===-1) {
                // 快递员没有登记过任何快递
                layer.msg("未查询到任何快递信息！")
                window.location.href = "index.html";
            } else if (values.status===-2) {
                // Session中找不到单号
                layer.msg("查询出现错误，请重新查找！");
                window.location.href = "index.html";
            } else {
                // 不存在的status值，未知的错误 (不太可能发生，但if else if else闭合原则最好遵守)
                window.location.href = "500.html";
            }
        });
    });
</script>
</html>